﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using DataAccess.SqlClient;
using Model;
using ApiDAL.Common;

namespace Dal
{
    public class StandDal
    {
        #region 显示大图
        /// <summary>
        /// 显示大图
        /// </summary>
        /// <returns></returns>
        public List<Stand> ShowStand()
        {
            SqlQuery sql = new SqlQuery();
            sql.CommandText = string.Format("select * from Stand");
            DataSet ds = SqlDataAccess.ExecDataset(sql);
            DataTable dt = ds.Tables[0];
            return DataReaderToObjectHelper.DataTableToList<Stand>(dt);

        }
        #endregion

        #region 添加大图
        /// <summary>
        /// 添加大图
        /// </summary>
        /// <param name="n"></param>
        /// <returns></returns>
        public int AddStand(Stand n)
        {
            SqlQuery sql = new SqlQuery();
            sql.CommandText = "insert into Stand values('" + n.standName + "','" + n.standPhoto + "','" + n.standPrice + "','" + n.StandDescrib + "')";
            return SqlDataAccess.ExecNonQuery(sql);
        }
        #endregion

        #region 删除主菜单
        /// <summary>
        /// 删除主菜单
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DelMenu(string id)
        {
            SqlQuery sql = new SqlQuery();
            sql.CommandText = "delete from Menu where MenuId in("+id+")";
            return SqlDataAccess.ExecNonQuery(sql);
        }
        #endregion
    }
}
